import Quick from ".";
import { WeaInput, WeaLocaleProvider } from 'ecCom';
const { getLabel } = WeaLocaleProvider;

export default class Main extends Quick {
    state = {
        fieldMark: '',
        optionKeys: ''
    }
    getComponent = () => {
        const { fieldMark, optionKeys } = this.state;
        return [
            <div>
                <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@tdn5hi@`}
                    style={{ width: 200 }}
                    placeholder={getLabel('528639', '请输入字段名称')}
                    value={fieldMark}
                    onChange={v => this.setState({ fieldMark: v })}
                />
            </div>,
            <div style={{ marginTop: 8 }}>
                <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@57m3qc@`}
                    style={{ width: 200 }}
                    placeholder={getLabel('528644','控制选择框的选项范围key值') }
                    value={optionKeys}
                    onChange={v => this.setState({ optionKeys: v })}
                />
            </div>
        ]
    }
    getTitle = () => {
        return 'excel.controlSelectOption';
    }
    getScript = () => {
        return `excel.controlSelectOption('${this.state.fieldMark}',${this.state.optionKeys});`
    }
}